package com.ruoyi.homepage.service.impl;

import java.util.List;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.homepage.mapper.TbTagMapper;
import com.ruoyi.homepage.domain.TbTag;
import com.ruoyi.homepage.service.ITbTagService;

/**
 * 标签Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-31
 */
@Service
public class TbTagServiceImpl implements ITbTagService 
{
    @Autowired
    private TbTagMapper tbTagMapper;

    /**
     * 查询标签
     * 
     * @param tagId 标签主键
     * @return 标签
     */
    @Override
    public TbTag selectTbTagByTagId(Long tagId)
    {
        return tbTagMapper.selectTbTagByTagId(tagId);
    }

    /**
     * 查询标签列表
     * 
     * @param tbTag 标签
     * @return 标签
     */
    @Override
    public List<TbTag> selectTbTagList(TbTag tbTag)
    {
        return tbTagMapper.selectTbTagList(tbTag);
    }

    /**
     * 新增标签
     * 
     * @param tbTag 标签
     * @return 结果
     */
    @Override
    public int insertTbTag(TbTag tbTag)
    {
        tbTag.setCreatedAt(new Date());
        tbTag.setUpdatedAt(new Date());
        return tbTagMapper.insertTbTag(tbTag);
    }

    /**
     * 修改标签
     * 
     * @param tbTag 标签
     * @return 结果
     */
    @Override
    public int updateTbTag(TbTag tbTag)
    {
        tbTag.setUpdatedAt(new Date());
        return tbTagMapper.updateTbTag(tbTag);
    }

    /**
     * 批量删除标签
     * 
     * @param tagIds 需要删除的标签主键
     * @return 结果
     */
    @Override
    public int deleteTbTagByTagIds(Long[] tagIds)
    {
        return tbTagMapper.deleteTbTagByTagIds(tagIds);
    }

    /**
     * 删除标签信息
     * 
     * @param tagId 标签主键
     * @return 结果
     */
    @Override
    public int deleteTbTagByTagId(Long tagId)
    {
        return tbTagMapper.deleteTbTagByTagId(tagId);
    }
}
